package com.niji.littly_donkey_android.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.niji.littly_donkey_android.R;
import com.niji.littly_donkey_android.bean.BillDetails;

import java.util.ArrayList;

public class BillWithdrawalAdapter extends ArrayAdapter<BillDetails> {


    private static final String TAG = "BillWithdrawalAdapter";

    public BillWithdrawalAdapter(Context context, ArrayList<BillDetails> members)
    {
        super(context,0, members);
    }
    @NonNull
    @Override
    public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
        BillDetails billDetails = getItem(position);

        if(convertView == null)
        {
            convertView = LayoutInflater.from(getContext()).inflate(R.layout.item_bill_withdrawal, parent, false);
        }

        TextView id = convertView.findViewById(R.id.bill_withdrawal_id);
        TextView name = convertView.findViewById(R.id.bill_withdrawal_name);
        TextView time = convertView.findViewById(R.id.bill_withdrawal_time);
        TextView money = convertView.findViewById(R.id.bill_withdrawal_money);
        //thumb.setImageBitmap(BitMap.getInstance().returnBitMap(u.getThumb()));
        id.setText("" + billDetails.getId());
        name.setText(billDetails.getName());
        time.setText(billDetails.getTime());
        money.setText("-" + billDetails.getMoney() + "元");
        return convertView;
    }

}



